<?php
/**
 * Created by PhpStorm.
 * User: zhaozhicheng
 * Date: 2018/3/14
 * Time: 下午9:25
 */

$redis = new Redis();

$redis->connect('127.0.0.1');

$redis->watch('count');  // 监视

$num =2;

if($num<=$redis->get('count')) exit('failed');
$redis->multi();
$redis->incr('count');
$res = $redis->exec();








